package com.personal.gateway.custom.customEnum.flinkCommandEnum;

import com.personal.gateway.flinkAllCommand.configurationOption.ConfigurationOption;
import com.personal.gateway.flinkAllCommand.configurationOption.configurationType.ConfigurationTypeEnumInterface;
import lombok.Getter;

import javax.annotation.Nonnull;

/**
 * @author BigHead
 * @date 2022/1/7 14:25
 * @description FlinkExecutionEnum
 */
@Getter
public enum FlinkExecutionEnum implements ConfigurationTypeEnumInterface {

    /**
     * 非application 启动方式
     */
    RUN("run"),
    /**
     * application 启动方式
     */
    RUN_APPLICATION("run_application");

    public final static Class<Enum<? extends ConfigurationTypeEnumInterface>> EXECUTION_TYPE_CLASS = (Class<Enum<? extends ConfigurationTypeEnumInterface>>) (Class<?>) FlinkExecutionEnum.class;
    private final String executionString;

    FlinkExecutionEnum(String executionString) {
        this.executionString = executionString;
    }

    @Override
    public String getShowValue() {
        return name();
    }

    @Override
    public String getSelectValue() {
        return executionString;
    }

    @Override
    public boolean checkExist(@Nonnull String... values) {
        if (values.length == 1){
            return executionString.equals(values[0]);
        }
        return false;
    }

    @Override
    public boolean checkExist(ConfigurationOption<?, ?> configurationOption, @Nonnull String... values) {
        return false;
    }

    @Override
    public boolean checkExampleValue(ConfigurationOption<?, ?> configurationOption) {
        return false;
    }
}
